<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>项目建设阶段、目标及资金使用计划</title>
<%@ include file="/common/meta.jsp"%>
<script type="text/javascript" src="${res}/js/proposal/irisPrpPrepare.js"></script>
<script type="text/javascript" src="${res}/js/validate/irisvalidator.js"></script>
<script type="text/javascript" src="${res}/js/autodisckey/autodisckey.js"></script>

<style type="text/css">
	.input_width { width:130px }
	.select_width { width:143px }
	.table_td td {border:0}
	.long_input{ width:642px }
    .selectWidth4{width:616px;}
    .table_tmp {  border-collapse:collapse;/*细线表格代码*/ }
	.table_tmp td { border:1px solid #b7d1e6;/*细线表格线条颜色*/ padding:4px; }
	.table_tmp th { border:1px solid #b7d1e6; font-weight:bold; text-align:center; background:#edf2f8; padding:4px; }
</style>
<script type="text/javascript">
var type = "${param.type}";
var parentTable = parent.$("#"+"${param.parentTab}");	//父页面的表格
var selectRadio = $();									//父页面选中的单选框
var selectTr = $();										//父页面选中的行

if(type=="edit") {
	selectRadio = parentTable.find(":radio:checked");
	selectTr = selectRadio.parents("tr");
}
$(function(){
	$("#tab1").click();
	$("#fragment-tab1 :text,#fragment-tab1 [type='date']").addClass("input_width");
	$("#fragment-tab1 select").addClass("select_width");
	$("table.t_css").each(function(){
		$(this).find("tr:even").addClass("li_1");
		$(this).find("tr:odd").addClass("li_2");
	});

	if(type=="edit"){
		$("input:not(:radio:button),textarea").each(function(){
			var id=$(this).attr("name");
			if(id==null || id==""){
				return true;
			}
			var parentObj=selectTr.find("[name$='/"+id+"']");
			var value="";
			if(parentObj.is("span")){
				value=parentObj.text();
			}else{
				value=parentObj.val();
			}
			$(this).val(value);
		});
		
		$("#prof_title").val($("#prof_title_name").val());
		
		$(":radio").each(function(){//初始化radio框
			var name=$(this).attr("name");
		
			
			var value=$("[name='"+name+"_value']").val();
			if($(this).val()==value)
				$(this).attr("checked",true);
			
		});
		
		initTblEquipments();
		initTblCertificates();
		
	}
	$("input,select").each(function(){
		if(!$(this).attr("class")||$(this).attr("class").indexOf("notdisabled")==-1)
			$(this).attr("disabled","true");
	});
	$("a,img").removeAttr("onclick");
	$(".color_red").css("display","none");
	$("img").css("display","none");
	$("textarea").attr("disabled","true");
	parent.$("#TB_ajaxWindowTitle").html("科技团队核心成员基本情况");
});

	
	function initTblEquipments(){
		var xmlStr = $("#equipments").val();
		var reg = /[\r\n]/g;
		/*空替换空格回车  */
		xmlStr=xmlStr.replace(reg,""); 
		if(xmlStr==null || xmlStr=="")
			return false;
		
		var equipmentNode = /<equipment[^s](.\n?)+?<\/equipment>/g;
		var equipment = xmlStr.match(equipmentNode);
		//console.log(xmlStr+"|"+equipment);
		if(equipment != null){
			for(var i=0; i<equipment.length; i++){
				$("#cmdAddbefore").click();
				equipment[i] = equipment[i].replace(reg,"");
				var j = i + 1;
				
				var start_date = equipment[i].match(/<start_date(.\n?)+?<\/start_date>/);
				if(start_date != null){
					start_date = start_date[0].replace(/<start_date.*?>|<\/start_date>/g,"");
					$("#equipment" + j +"_start_date").val(start_date);
				}
				
				var end_date = equipment[i].match(/<end_date(.\n?)+?<\/end_date>/);
				if(end_date != null){
					end_date = end_date[0].replace(/<end_date.*?>|<\/end_date>/g,"");
					$("#equipment" + j +"_end_date").val(end_date);
				}
				
				var school_dept = equipment[i].match(/<school_dept(.\n?)+?<\/school_dept>/);
				if(school_dept != null){
					school_dept = school_dept[0].replace(/<school_dept.*?>|<\/school_dept>/g,"");
					$("#equipment" + j +"_school_dept").val(school_dept);
				}
				
				var self_post = equipment[i].match(/<self_post(.\n?)+?<\/self_post>/);
				if(self_post != null){
					self_post = self_post[0].replace(/<self_post.*?>|<\/self_post>/g,"");
					$("#equipment" + j +"_self_post").val(self_post);
				}
			
				
			}
		}
	}
	
	function initTblCertificates(){
		var xmlStr = $("#certificates").val();
		var reg = /[\r\n]/g;
		/*空替换空格回车  */
		xmlStr=xmlStr.replace(reg,""); 
		if(xmlStr==null || xmlStr=="")
			return false;
		
		var certificateNode = /<certificate[^s](.\n?)+?<\/certificate>/g;
		var certificate = xmlStr.match(certificateNode);
		if(certificate != null){
			
			for(var i=0; i<certificate.length; i++){
				$("#cmdAddbefore2").click();
				certificate[i] = certificate[i].replace(reg,"");
				var j = i + 1;
				
				
				var name = certificate[i].match(/<name(.\n?)+?<\/name>/);
				if(name != null){
					name = name[0].replace(/<name.*?>|<\/name>/g,"");
					$("#certificate" + j +"_name").val(name);
				}
				
				var unit_dept = certificate[i].match(/<unit_dept(.\n?)+?<\/unit_dept>/);
				if(unit_dept != null){
					unit_dept = unit_dept[0].replace(/<unit_dept.*?>|<\/unit_dept>/g,"");
					$("#certificate" + j +"_unit_dept").val(unit_dept);
				}
				
				var end_date = certificate[i].match(/<end_date(.\n?)+?<\/end_date>/);
				if(end_date != null){
					end_date = end_date[0].replace(/<end_date.*?>|<\/end_date>/g,"");
					$("#certificate" + j +"_end_date").val(end_date);
				}
			
				
			}
		}
	}



function loadAjaxSelect(selectId,url,params,varParm){
	$.ajax( {
		url : url,
		type : 'post',
		dataType:'json',
		data : params,
		success : function(data) {
			
			for(var i=0;i<data.length;i++){
				var value=data[i].id;
				var text=data[i].name;		
				$("#"+selectId).append("<option value='"+value+"'>"+text+"</option>");
				

			}
			if(type=="edit"){//如果是修改，才需要初始化select框的值
				var selectValue=$("[name='"+selectId+"_value']").val();
				$("#"+selectId+" option").each(function(i,obj){
					if($(obj).val()==selectValue){
						setTimeout(function() {
							$(obj).attr("selected",true);
						}, 1);
					}
				});
			}
			
				
		}
	});
	}

function initTreeValueExt(treeId, treeNode) {
	   
	  if (!(treeNode && (treeNode.level > 0 || !treeNode.isParent))) {
		scmWarn($("#" + treeId).attr("label") + messageTip.researchAreaInvalidDisciplineCode);
		if (treeNode.level == 0) {
			$("#" + treeId).val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId+ "_code']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId+ "_value']").val("");
			$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId+ "_name']").val("");
		}
		
		return false;
		}
		var str = treeNode.name;
		var obj = treeNode.parentNode;
		while (obj != null) {
			obj = obj.parentNode;
		}
		
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_code'],[id$='" + treeId+ "_code']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_value'],[id$='" + treeId+ "_value']").val(treeNode.id);
		$("#" + treeId).parents("td").find("[name$='" + treeId + "_name'],[id$='" + treeId+ "_name']").val(str);
		
	}

function setRadioValue(){
	var gender = $("input[name='gender'][type='radio']:checked").val();
	if(!!gender){
		if(gender=='M'){
			$("#gender_name").val("男");
		}else if(gender=='F'){
			$("#gender_name").val("女");
		}
	}
	var oversea = $("input[name='oversea'][type='radio']:checked").val();
	if(!!oversea){
		if(oversea=='1'){
			$("#oversea_name").val("有");
		}else if(oversea=='2'){
			$("#oversea_name").val("无");
		}
	}
	var plan_level = $("input[name='plan_level'][type='radio']:checked").val();
	if(!!plan_level){
		if(plan_level=='1'){
			$("#plan_level_name").val("省级");
		}else if(plan_level=='2'){
			$("#plan_level_name").val("市级");
		}
	}
	
}

</script>

</head>
<body>
	<div id="tabnav">
		<ul>
			<li class="down" id="tab1" onclick="changeTab(this.id)">
					<a href="###"><span>团队核心成员基本信息</span></a>
			</li>
			<li class="down" id="tab2" onclick="changeTab(this.id)">
					<a href="###"><span>学习和工作经历</span></a>
			</li>
			<li class="down" id="tab3" onclick="changeTab(this.id)">
					<a href="###"><span>工作经历和业绩</span></a>
			</li>
		</ul>
	</div>
	
	<div class="tab_box" id="fragment-tab1">
		<table class="table01  t_css" width="665px" border="0" cellpadding="0" label="项目计划" cellspacing="1">
		    <col width="20%">
		    <col width="30%">
		    <col width="20%">
		    <col width="30%">
			<tr>
				<td align="right"><span class="color_red">*</span>姓名：</td>
				<td>
					<input type="text" label="姓名" name="zh_name" class="required" maxlength="50" style="width:90%"/>
				</td>
				<td align="right"><span class="color_red">*</span>性别：</td>
				<td>
					<input type="radio" id="gender_1" name="gender" label="性别" value="M" class="do"  onclick="initControlValue(this.id);setRadioValue();" /><label>男</label>
					&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="radio" id="gender_2" name="gender" value="F" class="do"  onclick="initControlValue(this.id);setRadioValue();" /><label>女</label>
					<input type="hidden" name="gender_value" label="性别" class="required" />
					<input type="hidden" id="gender_name" name="gender_name" label="" />
				</td>
			</tr>
			<tr>
				<td align='right'><span class="color_red">*</span>出生日期：</td>
	          	<td>
				<cpt:date id="birthday"  value="" className="required date beforeToday" label="出生日期"   name="birthday" ></cpt:date> 
			    </td>
			    <td align="right"><span class="color_red">*</span>国籍：</td>
				<td >
					<cpt:select id="country" key="country" onChange="initControlValue(this.id)" style="width:95%"></cpt:select>
					<input type="hidden" name="country_value" id="country_value" label="国籍" class="required"/>
					<input type="hidden" name="country_name"/>
				</td>
			</tr>
			<tr>
				<td align="right"><span class="color_red" >*</span>学位：</td>
				<td>
					<cpt:select id="degree"  key="degree"  onChange="initControlValue(this.id);" style="width:93%"></cpt:select>
					<input type="hidden" name="degree_value" value="" label="学位" class="required">
					<input type="hidden" name="degree_name" value="">
				</td>
				<td align="right"><span class="color_red">*</span>专业：</td>
			    <td>
			        <input type="text" label="专业" name="major_work" class="required" maxlength="50" style="width:90%"/>
			    </td>
			</tr>
			<tr>
				<td align="right"><span class="color_red">*</span>职称：</td>
				<td>
				<cpt:tree key="prof_title" cacheable="false" readonly="true" value="" id="prof_title" name="prof_title"  showPattern="all" shieldPattern="-1" width="88%"
				onClick="initTreeValueExt"   label="职称" />
				<input type="hidden" id="prof_title_value" name="prof_title_value" value="" class="required"  label="职称"/> 
				<input type="hidden" id="prof_title_name" name="prof_title_name" value="" />
				</td>
				<td align="right"><span class="color_red">*</span>执业资格：</td>
				<td>
					<input type="text" label="执业资格" name="qualification" class="required" maxlength="50" style="width:90%"/>
				</td>
			</tr>
			<tr>
				<td align="right"><span class="color_red">*</span>身份证或护照号：</td>
				<td>
				<input type="text" label="身份证或护照号" name="card_type_name" class="required" maxlength="50" style="width:90%"/>
				</td>
				<td align="right"><span class="color_red">*</span>有无海外学习或工作经历：</td>
				<td>
					<input type="radio" id="oversea_1" name="oversea" label="有无海外学习或工作经历" value="1" class="do"  onclick="initControlValue(this.id);setRadioValue();" /><label>有</label>
					&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="radio" id="oversea_2" name="oversea" value="2" class="do"  onclick="initControlValue(this.id);setRadioValue();" /><label>无</label>
					<input type="hidden" name="oversea_value" label="有无海外学习或工作经历" class="required" />
					<input type="hidden" id="oversea_name" name="oversea_name" label="" />
				</td>
			</tr>
			<tr>
				<td align="right"><span class="color_red" >*</span>（来皖前）住址：</td>
				<td>
					<input type="text" label="（来皖前）住址" name="before_address" class="required" maxlength="50" style="width:90%"/>
				</td>
				<td align="right"><span class="color_red">*</span>在原单位担任的职务：</td>
			    <td>
			        <input type="text" label="在原单位担任的职务" name="before_position" class="required" maxlength="50" style="width:90%"/>
			    </td>
			</tr>
			
			<tr>
				<td align="right"><span class="color_red" >*</span>（来皖前）工作单位：</td>
				<td>
					<input type="text" label="（来皖前）工作单位" name="before_dept" class="required" maxlength="50" style="width:90%"/>
				</td>
				<td align="right">来皖时间（省内团队免填）：</td>
			    <td>
			        <cpt:date id="come_time"  value="" className="date beforeToday" label="来皖时间"   name="come_time" ></cpt:date> 
			    </td>
			</tr>
			<tr>
				<td align="right"><span class="color_red">*</span>本人电话：</td>
				<td>
					<input type="text" id="mobile" name="mobile" maxlength="20"  class="required"   label="本人电话" style="width:90%"/>
				</td>
				<td align="right"><span class="color_red">*</span>电子邮箱：</td>
				<td>
					<input type="text" name="email" required class="required email" label="电子邮箱" style="width:90%"/>
				</td>
			</tr>
			<tr>
				<td align="right">入选国家引才计划情况：</td>
				<td colspan="3"></td>
			</tr>
			<tr>
				<td align="right">计划名称：</td>
				<td>
					<input type="text" label="入选国家引才计划情况->计划名称" name="state_plan"  maxlength="50" style="width:90%"/>
				</td>
				<td align="right">入选年度：</td>
			    <td>
			        <input type="text" name="state_time" id="state_time" label="入选国家引才计划情况->入选年度" onfocus="InitInput.setInt(this, 4)" style="text-align:right;width:86%" maxlength="4" class="input_text year"/>年 
			    </td>
			</tr>
			<tr>
				<td align="right">申报省份：</td>
				<td>
					<input type="text" label="入选国家引才计划情况->申报省份" name="state_declared"  maxlength="50" style="width:90%"/>
				</td>
				<td colspan="2"></td>
			</tr>
			
			<tr>
				<td align="right">入选地方人才计划情况：</td>
				<td colspan="3"></td>
			</tr>
			<tr>
				<td align="right">计划名称：</td>
				<td>
					<input type="text" label="入选地方人才计划情况->计划名称" name="local_plan"  maxlength="50" style="width:90%"/>
				</td>
				<td align="right">入选年度：</td>
			    <td>
			        <input type="text" name="local_time" id="local_time" label="入选地方人才计划情况->入选年度" onfocus="InitInput.setInt(this, 4)" style="text-align:right;width:86%" maxlength="4" class="input_text year"/>年
			    </td>
			</tr>
			<tr>
				<td align="right">计划级别：</td>
				<td>
					<input type="radio" id="plan_level_1" name="plan_level" label="入选地方人才计划情况->计划级别" value="1" class="do"  onclick="initControlValue(this.id);setRadioValue();" /><label>省级</label>
					&nbsp;&nbsp;&nbsp;&nbsp;
					<input type="radio" id="plan_level_2" name="plan_level" value="2" class="do"  onclick="initControlValue(this.id);setRadioValue();" /><label>市级</label>
					<input type="hidden" name="plan_level_value" label="入选地方人才计划情况->计划级别"  />
					<input type="hidden" id="plan_level_name" name="plan_level_name" label="" />
				</td>
				<td align="right">资助金额（万元）：</td>
			    <td>
					<input type="text" label="入选地方人才计划情况->资助金额" name="get_cost"    onfocus="InitInput.setNumber(this,9,4,2)" style="text-align:right;width:86%"  maxlength="50"/>
			    </td>
			</tr>
		</table>
	</div>
	

<div class="tab_box" id="fragment-tab2"  style="display:none">
<div class="t_bar"><span class="color_red">*</span>学习（从本科起）和工作经历</div>

	<input type="hidden" id="equipments" name="equipments" >
	<table  id="tblEquipments" cellpadding="0" class="table_tmp" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead>
					<tr style="border:1px solid #B7D1E6">
						<th class="TblHead" align="center"  width="5%">选择</th>
						<th class="TblHead" align="center"  width="5%">序号</th>
						<th class="TblHead" align="center"  width="14%">开始时间</th>
						<th class="TblHead" align="center"  width="14%">结束时间</th>
						<th class="TblHead" align="center"  width="46%">学校或工作单位</th> 
						<th class="TblHead" align="center"  width="16%">本人身份（职务）</th> 
					</tr>
			</thead>
			<tbody id="tab">
					<tr  style="display:none">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name="selEquipments" >
						</td>
						<td align="center">&nbsp;
							<span name="equipments|equipment[0]@seq_no" >[index]</span> 
						</td>
						<td align="center">&nbsp; 
						<input id="equipment[index]_start_date" name="equipments|equipment[0]|start_date" label="开始时间" value=""
							class=" required input_text date  dateCompare:equipment[index]_end_date dateCompareAfterE:equipment[index]_start_date:start_date"
							style="width: 70px" />
						</td>
						<td align="center">&nbsp;<input id="equipment[index]_end_date" name="equipments|equipment[0]|end_date" label="结束时间" value=""
							class=" required input_text date dateCompareBeforeE:equipment[index]_end_date:end_date "
							style="width: 70px"/>
						</td>
						<td>
							<input type="text" name="equipments|equipment[0]|school_dept" id="equipment[index]_school_dept" label="学校或工作单位" style="width:85%;" class="input_text required " maxlength="50"/>
						</td> 
						<td>
							<input type="text" name="equipments|equipment[0]|self_post" id="equipment[index]_self_post" label="本人身份（职务）" style="width:85%;" class="input_text required " maxlength="50" />
						</td> 
					</tr>
					
				</tbody>
			</table>
			<br>
			<table>
			  <tr style="display: none;">
				<td colspan="6">
					<input class="button" name="cmdAddbefore" type=button value="添加" id="cmdAddbefore"
						onclick="if(checkTabLimit('tblEquipments',100,'学习（从本科起）和工作经历最多只能填写100条')){addNewRow('tblEquipments');showDateTag('tblEquipments');}try{top.resizeFrame();}catch(e){};">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblEquipments','selEquipments')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblEquipments','selEquipments')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblEquipments','学习（从本科起）和工作经历');">

				</td>
				</tr>
			</table>
			<br/>
			
		<div class="t_bar"><span class="color_red">*</span>取得学历、学位和资质证书情况</div>		
	<input type="hidden" id="certificates" name="certificates" >
	<table  id="tblCertificates" cellpadding="0" class="table_tmp" width="100%" border="0" cellpadding="0" style="*border-bottom: #a1c0dc 1px solid;">
			<thead>
					<tr style="border:1px solid #B7D1E6">
						<th class="TblHead" align="center"  width="5%">选择</th>
						<th class="TblHead" align="center"  width="5%">序号</th>
						<th class="TblHead" align="center"  width="46%">证书名称</th> 
						<th class="TblHead" align="center"  width="16%">发证机关/单位</th>
						<th class="TblHead" align="center"  width="14%">发证时间</th>
						 
					</tr>
			</thead>
			<tbody id="tab">
					<tr  style="display:none">
						<td align="center">&nbsp;
							<input type="radio" class="radiobutton" name="selCertificates" >
						</td>
						<td align="center">&nbsp;
							<span name="certificates|certificate[0]@seq_no" >[index]</span> 
						</td>
						<td>
							<input type="text" name="certificates|certificate[0]|name" id="certificate[index]_name" label="证书名称" style="width:85%;" class="input_text required " maxlength="50"/>
						</td> 
						<td>
							<input type="text" name="certificates|certificate[0]|unit_dept" id="certificate[index]_unit_dept" label="发证机关/单位" style="width:85%;" class="input_text required " maxlength="50" />
						</td> 
						<td align="center">&nbsp;<input id="certificate[index]_end_date" name="certificates|certificate[0]|end_date" label="发证时间" value=""
							class=" required input_text date beforeToday"
							style="width: 70px"/>
						</td>
						
					</tr>
					
				</tbody>
			</table>
			<br>
			<table>
			  <tr >
				<td colspan="6" style="display: none;">
					<input class="button" name="cmdAddbefore" type=button value="添加" id="cmdAddbefore2"
						onclick="if(checkTabLimit('tblEquipments',100,'取得学历、学位和资质证书情况最多只能填写100条')){addNewRow('tblCertificates');showDateTag('tblCertificates');}try{top.resizeFrame();}catch(e){};">
					<input class="button" name="cmdMovePrev" type=button value="上移" onclick="movePrev('tblCertificates','selCertificates')">
					<input class="button" name="cmdMoveNext" type=button value="下移" onclick="moveNext('tblCertificates','selCertificates')">
					<input class="button" name="cmddel" type=button  value="删除" onclick="deleteSelectedRow('tblCertificates','取得学历、学位和资质证书情况');">

				</td>
				</tr>
			</table>	
			
</div>
<div class="tab_box" id="fragment-tab3"  style="display:none">
	<table class="table01  t_css" width="665px" border="0" cellpadding="0" cellspacing="1">
	<tr><td align="left"><span class="color_red">*</span>注：应重点反映其创业或创新经历与业绩，限800字内：</td></tr>
     <tr><td>
			  <textarea rows="8" style="width:98%;"  class="input_textarea required maxlength:800"  id="achievements" name="achievements" label="创业或创新经历与业绩"></textarea>
			  <input type="hidden"  name="achievements_hidden" id="achievements_hidden" value="">
		 </td>
	</tr>
	</table>
</div>
<br/>
<table width="100%" align="center">
		<tr>
			<td>
				&nbsp;<input type="button" id="cancel" class="button_01 notdisabled" value="关闭" onclick="parent.tb_remove();">
			</td>
		</tr>
	</table>
</body>
</html>

